#!/usr/bin/python
# -*- coding: UTF-8 -*-
import rospy
from std_msgs.msg import String
from robot_by_fe3.msg import location
#i=0
location_data=[]
def get_location_label(data):
    if data.location_label=='location_label':
        location_data[:]=[]
    else:
        location_data.append(data)
        print location_data

flag='stop'
def robot_action(data):
    flag=data.data

def robot_stop(data):
    flag = data.data

rospy.init_node('Robot_Fe3', anonymous=True)
state_pub = rospy.Publisher('robot_state', String, queue_size=10)

rospy.Subscriber('location', location, get_location_label)
rospy.Subscriber('fe_robot_action', String, robot_action)
rospy.Subscriber('fe_robot_stop', String, robot_stop)

while True:
    # if len(location_data) != 0:
    #     #print location_data.index('A-01')
    #     for i in range(len(location_data)):
    #
    #         if 'A-01' in location_data[i].location_label:
    #
    #             print 'ok' +str(i)

            #print  i
        # for i in range(len(location_data)):
        #     print location_data[i].location_label

    print flag
    pass
